$search-icon-width: 40px;
$search-input-width: 150px;
$form-toggle-width: 120px;
$header-height: 48px;
$toggle-width: 80px;

bz-query-panel {
  @include panel;
  // border-bottom: 1px solid $grey-4;
  padding: 0;
}

bz-query-panel .header {
  position: relative;
  line-height: $header-height;
  height: $header-height;
  padding-right: $form-toggle-width;

  &.show-search {
    padding-right: $search-icon-width + $search-input-width + $form-toggle-width;
  }

  .action-bar {
    padding-left: $box-space;
    padding-right: $box-space;
    border-bottom: solid 1px $grey-4;
    height: 100%;
    overflow: hidden;

    .primary-action,
    .secondary-action {
      a:not(.ant-btn) {
        margin-right: $box-space;
        color: $grey-7;
      }

      i.anticon-upload {
        font-size: 1.2em;
      }

      i.anticon-download {
        font-size: 1.2em;
      }
    }

    &.show-form {
      border-bottom: none;
    }
  }

  .query-input {
    position: absolute;
    top: 0;
    right: $form-toggle-width;
    height: 100%;
    color: $grey-7;
    width: $search-input-width + $search-icon-width;
    margin-left: -1px;
    border-left: solid 1px $grey-4;
    cursor: pointer;
    overflow: hidden;

    input {
      border-width: 0;
      width: calc(100% - #{$search-icon-width} - 1px);
      height: 100%;
      padding-right: 2em;
    }

    .search-icon {
      width: $search-icon-width;
    }

    .search-text-close {
      position: absolute;
      right: 1em;
      top: calc(50% - 0.5em);
    }
  }

  .form-toggle {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: $form-toggle-width;
    text-align: center;
    margin-left: -1px;
    border-left: solid 1px $grey-4;
    color: $grey-7;
    cursor: pointer;
    user-select: none;
    overflow: hidden;
    padding-left: 12px;
    padding-right: 12px;
    display: flex;
    justify-content: space-between;
  }
}

bz-query-panel .query-form {
  // border-top: solid 1px $grey-4;
  padding: $box-space;
  padding-bottom: 0;
}

bz-query-panel:not(.has-form) {
  .header {
    padding-right: 0;
    border-width: 0;

    &.show-search {
      padding-right: $search-icon-width + $search-input-width;
    }

    .query-input {
      right: 0;
    }

    .form-toggle {
      width: 0;
      border-width: 0;
    }
  }

  .query-form {
    display: none !important;
  }

}

bz-query-panel .query-action-bar {
  display: block;
  position: relative;
  overflow: hidden;
  padding: 0 $box-space $box-space*0.75;

  &.hidden-form {
    padding-top: $box-space;

    .toggle-btn {
      top: $box-space;
    }
  }

  .toggle-btn {
    position: absolute;
    top: 0;
    right: $box-space;
    padding-left: 0;
    padding-right: 0;
    transition: top 0s;
    color: $grey-8 !important;
  }
}

bz-query-panel.attract-bottom {
  margin-bottom: -$box-space*0.75;
}
